package com.teamide.param;

import java.util.Map;

/**
 * 用于分页查询，需要传入查询的sql、统计的sql、页码、每页数量等
 * 
 * @author ZhuLiang
 *
 */
public class PageSqlParam extends SqlParam {

	public static final int DEFAULT_PAGE_SIZE = 20;

	public PageSqlParam(String sql, String countsql, Map<String, Object> param) {

		super(sql, param);
		this.countsql = countsql;
	}

	private final String countsql;

	private int pageindex = 1;

	private int pagesize = 10;

	public int getPageindex() {
		return pageindex;
	}

	public void setPageindex(int pageindex) {
		this.pageindex = pageindex;
		this.pageindex = pageindex < 0 ? 0 : pageindex;
	}

	public int getPagesize() {
		return pagesize;
	}

	public void setPagesize(int pagesize) {
		this.pagesize = pagesize;
		this.pagesize = pagesize <= 0 ? DEFAULT_PAGE_SIZE : pagesize;
	}

	public String getCountsql() {
		return countsql;
	}

}
